#include "stdafx.h"
#include "Airport.h"

void Airport::ParseDictionary(Dictionary p_Dictionary)
{
	Dictionary::iterator p = p_Dictionary.begin();
	Name = p->second; p++;
	SysIns = (p->second=="true") ? true : false; p++;
	if(p->first=="cisinfo")
	{
		CisInfo = (p->second=="true") ? true : false; p++;
	}
	Elev = atoi(p->second.c_str()); p++;
	Location.Y = p->second; p++;
	Location.X = p->second; p++;
	DepDel = atoi(p->second.c_str()); p++;
	AType = p->second; p++;
}

std::string Airport::Key()
{
	return Name;
}

void Airport::Print()
{
	Point t_Point = Location;
	std::cout << "Airport name: " << Name << std::endl;
    std::cout << "System Installed Indicator: " << (SysIns ? "true" : "false") << std::endl;
    std::cout << "Elevation: " << Elev << std::endl;
	std::cout << "Latitude: " << Location.Y << std::endl;
	std::cout << "Longitude: " << Location.X << std::endl;
	std::cout << "X: " << t_Point.X << std::endl;
	std::cout << "Y: " << t_Point.Y << std::endl;
    std::cout << "Departure Delay: " << DepDel << std::endl;
    std::cout << "Airport type: " << AType << std::endl;
	std::cout << "------------------------------" << std::endl;
}

AirportMap::AirportMap() : AdaptationMap<Airport>(AIRPORTADAPTFILENAME)
{
}
